package boardgamer.common.client.testing;

import android.graphics.Canvas;
import android.graphics.RectF;
import boardgamer.common.client.Button;

/**
 * @author garysoed
 */
public class MockButton implements Button {
  
  public RectF collisionBox = new RectF();
  public RectF boundingRect = new RectF();
  public boolean isDrawn = false;
  
  public MockEventHandler eventHandler = new MockEventHandler();

  public MockButton() { }

  public MockButton(RectF collisionBox, RectF boundingRect) {
    this.collisionBox = collisionBox;
    this.boundingRect = boundingRect;
  }
  
  @Override
  public void draw(Canvas canvas) {
    this.isDrawn = true;
  }

  @Override
  public void handleEvent(float eventX, float eventY, int eventAction) {
    eventHandler.onEvent(eventX, eventY, eventAction);
  }

  @Override
  public RectF getCollisionBox() {
    return collisionBox;
  }

  @Override
  public void setBoundingRect(RectF boundingRect) {
    this.boundingRect = new RectF(boundingRect);
  }

  @Override
  public RectF getBoundingRect() {
    return new RectF(boundingRect);
  }
}
